use crate::config::api_config::ApiResult;
use crate::entity::Page;
use crate::wechat::entity::wechat_user::WechatUser;
use crate::wechat::service::wechat_service::WechatUserService;
use salvo::{handler, Depot, Request};

#[handler]
#[tracing::instrument]
pub async fn page(request: &mut Request, depot: &mut Depot) -> ApiResult<Page<WechatUser>> {
    let result = WechatUserService::page(request, depot).await;
    ApiResult::from(result)
}


#[handler]
#[tracing::instrument]
pub async fn cursor(request: &mut Request, depot: &mut Depot) -> ApiResult<Vec<WechatUser>> {
    let result = WechatUserService::cursor(request, depot).await;
    ApiResult::from(result)
}

#[handler]
#[tracing::instrument]
pub async fn import(request: &mut Request, depot: &mut Depot) -> ApiResult<()> {
    let result = WechatUserService::import(request, depot).await;
    ApiResult::from(result)
}

#[handler]
#[tracing::instrument]
pub async fn insert(request: &mut Request, depot: &mut Depot) -> ApiResult<()> {
    let result = WechatUserService::insert(request, depot).await;
    ApiResult::from(result)
}